package com.qst.crop.demo.service;

import com.qst.crop.demo.entity.Product;
import com.qst.crop.demo.entity.ShoppingCart;
import com.qst.crop.demo.mapper.CartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartService {

    @Autowired
    CartMapper cartMapper;

    public Integer updateQua(long productId, String ownerEmail){
        return cartMapper.updateQua(productId, ownerEmail);
    }

    public Integer updateQua2(long productId, String ownerEmail){
        return cartMapper.updateQua2(productId, ownerEmail);
    }

    public Integer updatePri(double totalPrice, long productId, String ownerEmail){
        return cartMapper.updatePri(totalPrice, productId, ownerEmail);
    }

    public Integer add(ShoppingCart shoppingCart){
        return cartMapper.add(shoppingCart);
    }

    public Integer del(long productId, String ownerEmail){
        return cartMapper.del(productId, ownerEmail);
    }

    public List<ShoppingCart> getAll(String ownerEmail){
        return cartMapper.getAll(ownerEmail);
    }

    public Long getQua(long productId, String ownerEmail){
        return cartMapper.getQua(productId, ownerEmail);
    }

}
